package com.teenlinuxlounge.rag;

import android.app.Activity;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.TextView;
import android.text.Editable;
import android.view.*;
import android.widget.Button;

public class RateAGirl extends Activity implements android.view.View.OnClickListener {
	EditText Apperance;
	EditText Humor;
	EditText Intel;
	EditText MentalStable;
	Button Calculate;
	TextView Rating;
	
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle icicle) {
       super.onCreate(icicle);
       setContentView(R.layout.main);
       
       Apperance = (EditText)this.findViewById(R.id.Appearance);
       Humor = (EditText)this.findViewById(R.id.Humor);
       Intel = (EditText)this.findViewById(R.id.Intel);
       MentalStable = (EditText)this.findViewById(R.id.MentalStable);
       
       Rating = (TextView)this.findViewById(R.id.Rating);
       
       Calculate = (Button)this.findViewById(R.id.Calculate);
       Calculate.setOnClickListener(this);
   }


public void ratingCalculate(){
	int apperanceInt = Integer.parseInt(Apperance.getText().toString());
	int humorInt = Integer.parseInt(Humor.getText().toString());
	int intelInt = Integer.parseInt(Intel.getText().toString());
	int mentalStableInt = Integer.parseInt(MentalStable.getText().toString());
	int ratingInt = (apperanceInt + humorInt + intelInt + mentalStableInt) / 4;
	
	Rating.setText("Their rating is : "+ ratingInt);
	
}


@Override
public void onClick(View v) {
	// TODO Auto-generated method stub
	this.ratingCalculate();
	
}
}